import QtQuick 2.10
import QtQuick.Window 2.10

Rectangle {
    id:home
    visible: true
    width: 640
    height: 480


    Text {
        id: name
        anchors.centerIn:home
        text: qsTr("home.qml")
    }
    MouseArea{
        anchors.fill: home
        onClicked: {
             console.debug("主页");
        }
    }

    MouseArea{
        anchors.left:home.left
        anchors.top:home.top
        width:80
        height: 40
        onClicked:{
            console.debug("home按钮点击");
              var component = Qt.createComponent("qrc:/page1.qml");
             if (component.status === Component.Ready) {
                 var aQml = component.createObject(home);
                 aQml.z=4
                 home.visible = false
             }
        }

        Text
        {
            text:"页面1"
        }
    }
    MouseArea{
        anchors.right:home.right
        anchors.top:home.top
        width:80
        height: 40
        onClicked:{
            console.debug("main按钮点击");
              var component = Qt.createComponent("qrc:/page2.qml");
             if (component.status === Component.Ready) {
                 var aQml = component.createObject(home);
                 home.visible = false
             }
        }
    }
}
